<template>
	<view >
		<view class="VideoList-total">数量{{total}}</view>
		<view class="VideoList" v-for="(item,index) in list" :key="index">
			<image :src="`${serverUrl}${item.F_Headimg}`" alt="" />
			<view class="VideoList-name">
				<view>{{item.F_Title}}</view>
				<view>{{item.F_Org_Id}}</view>
			</view>
		</view>
	</view>
</template>

<script setup>
	import {
		ref,
		onMounted
	} from 'vue' // 修正导入内容，移除错误的res导入
	import {
		getDevices
	} from '@/utils/api/Home.js'
	import {serverUrl} from '@/utils/components.js'
	const list = ref(null)
	const total = ref(null)
	onMounted(async () => {
		try {
			const res = await getDevices()
			console.log(res.code);
			list.value = res.data;
			total.value = res.total
			console.log(list.value);
		} catch (error) {
			console.error('获取设备列表出错:', error)
		}
	})
	
</script>

<style scoped>
	image{
		width: 100%;
		height: 100%;
		border-radius: 20rpx;
	}
	.VideoList-total{
		font-size: 14px;
		margin-left: 20rpx;
		margin-top: 20rpx;
	}
	.VideoList{
		width: 90%;
		height: 340rpx;
		margin: 20rpx auto;
		position: relative;
		border-radius: 20rpx;
		overflow: hidden;
	}
	
	.VideoList-name{
		width: 100%;
		height: 70rpx;
		position: absolute;
		color: #fff;
		bottom: 0;
		display: flex;
		justify-content: space-between;
		align-items: center;
		background-color: rgba(0, 0, 0, 0.5); /* 半透明黑色背景 */
	}
</style>